#include <iostream>
#include <stdio.h>
using namespace std;
using ll = long long;
int main()
{
    ll n, m, sum = 0;
    cin >> n >> m;
    for (ll i = 1; i <= m; i++)
    {
        ll x;
        cin >> x;
        sum = sum + x;
    }
    sum = sum - n * (m - 1);
    if (n <= m || sum <= 0)
    {
        cout << 0;
        return 0;
    }
    cout << sum << endl;

    return 0;
}